package day11.Exer;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Menu {
    public static void main(String[] args)  {
        Scanner in = new Scanner(System.in);
        System.out.println(" 1：登陆。2：注册。3：联系客服。");
        int chosen;
        while (true) {
            System.out.println("请选择（输入1-3）：");
            try {
                chosen=in.nextInt();
                if (chosen == 1) {
                    System.out.println("登录");
                    break;
                }
                if (chosen == 2) {
                    System.out.println("注册");
                    break;
                }
                if (chosen == 3) {
                    System.out.println("联系客服");
                    break;
                }
                System.out.println("输入错误，请重新输入：");
            } catch (InputMismatchException e) {
                System.out.println("输入错误,请重新输入"+e);
                in.next();
            }
        }
    }
}
